<!DOCTYPE html>
<html lang="en">
<head th:insert="/admin/common/head::css"></head>
<body>
<div th:insert="/admin/common/header::header" ></div>
<!--  main  -->
<div class="container-fluid">
    <div class="row-fluid">
        <div th:insert="/admin/common/side::side" ></div>
        <!-- content -->
        <div style="display: flex; flex-direction: column">
            <div class="span10" id="content">
                <div class="row-fluid">
                    <!-- block -->
                    <div class="block">
                        <div class="navbar navbar-inner block-header" style="display: flex;flex-direction: column">
                        <a th:if="${loginUser.userType == 0}" style="margin-right: 10px;width: 18%;height: 30%" class="btn btn-default" th:href="@{/admin/msg/add.html}" role="button">增加通知</a>
                            <form method="post" th:action="@{/admin/msg/page}">
                                <input type="text" name="name" value="" placeholder="活动名称"/>
                                <button style="margin-bottom: 18px" type="submit" class="btn btn-primary"  >搜索</button>
                            </form>
                        </div>
                        <div class="block-content collapse in">
                            <div class="span12">
                                <table class="table">
                                    <thead>
                                    <tr>
                                        <th>序号</th>
                                        <th>活动名称</th>
                                        <th>通知内容</th>
                                        <th>发送人</th>
                                        <th>发送时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr th:each = "msg : ${page.records}">
                                        <td th:text="${msg.id}"></td>
                                        <td th:text="${msg.active.name}"></td>
                                        <td th:text="${#dates.format(msg.time, 'yyyy/MM/dd')}"></td>
                                        <td th:text="${msg.user.username}"></td>
                                        <td th:text="${msg.time}"></td>
                                        <td>
                                            <!--            //这样可以拿到对应数据-->
                                            <a class="btn btn-default" th:href="@{/admin/msg/detail(id = ${msg.id})}" role="button">  查看 </a>
                                            <a th:if="${loginUser.userType == 0}" class="btn btn-default" th:href="@{/admin/msg/delete(id = ${msg.id})}" role="button">删除</a>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    <!-- /block -->
                </div>
            </div>
            <div th:insert = "/admin/common/page::page"></div>
        </div>
        <!-- content -->
    </div>
</div>
<!--  main  -->
</body>
<div th:insert="/admin/common/footer::js" ></div>
<script type="text/javascript">

    document.getElementById("msg").className = 'active'
</script>
</html>